Skip to content

feat: make engines configurable via --engine CLI flags#8

Merged
kalbasit merged 2 commits intomainfrom
feat-make-engines-configurable
Mar 21, 2026
Merged

feat: make engines configurable via --engine CLI flags#8
kalbasit merged 2 commits intomainfrom
feat-make-engines-configurable

Conversation

@kalbasit
Copy link
Owner

@kalbasit kalbasit commented Mar 21, 2026

Previously, Run() hardcoded three engines (sqlite, postgres, mysql),
which forced all callers to generate wrappers for all three databases.
This became a problem for stowix/uar which dropped MySQL support —
sqlc-multi-db would still try to open mysqldb/ directories that no
longer exist.

This change:

  • Adds a repeatable --engine name:package flag to the CLI so callers opt
    in to exactly the engines they need.
  • Removes the hardcoded engines slice from generator.Run(), passing it
    as a parameter instead.
  • Exits with a fatal error when no --engine flags are provided.
  • Updates README.md to document the new --engine flag and updated
    library API.

Previously, Run() hardcoded three engines (sqlite, postgres, mysql), which
forced all callers to generate wrappers for all three databases. This became
a problem for stowix/uar which dropped MySQL support — sqlc-multi-db would
still try to open mysqldb/ directories that no longer exist.

This change:
- Adds a repeatable --engine name:package flag to the CLI so callers opt in
  to exactly the engines they need.
- Removes the hardcoded engines slice from generator.Run(), passing it as a
  parameter instead.
- Exits with a fatal error when no --engine flags are provided.
- Updates README.md to document the new --engine flag and updated library API.
@kalbasit
Copy link
Owner Author

This change is part of the following stack:

Change managed by git-spice.

@gemini-code-assist
Copy link

Summary of Changes

Hello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request significantly enhances the sqlc-multi-db tool by introducing configurable database engines via command-line flags. This change addresses the previous limitation where the tool hardcoded support for SQLite, PostgreSQL, and MySQL, which could lead to unnecessary wrapper generation or issues when projects dropped support for specific databases. Users can now explicitly specify the required engines, providing greater flexibility and preventing unwanted file generation.

Highlights

  • Configurable Engines via CLI: Introduced a repeatable --engine name:package CLI flag, allowing users to explicitly select the database engines they need.
  • Refactored Generator API: Modified the generator.Run() function to accept a slice of Engine configurations, removing the previous hardcoded engine definitions.
  • Improved Error Handling: Implemented a fatal error exit if no --engine flags are provided, ensuring explicit configuration.
  • Updated Documentation: Revised README.md to document the new --engine flag, updated requirements, and demonstrated the new library API usage.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

@codecov-commenter
Copy link

codecov-commenter commented Mar 21, 2026

Codecov Report

❌ Patch coverage is 0% with 22 lines in your changes missing coverage. Please review.
✅ Project coverage is 28.83%. Comparing base (c725291) to head (32be278).

Files with missing lines Patch % Lines
main.go 0.00% 21 Missing ⚠️
generator/generator.go 0.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main       #8      +/-   ##
==========================================
- Coverage   29.21%   28.83%   -0.38%     
==========================================
  Files           6        6              
  Lines         688      697       +9     
==========================================
  Hits          201      201              
- Misses        476      485       +9     
  Partials       11       11              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Copy link

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces a valuable feature by making the database engines configurable via CLI flags, which significantly increases the tool's flexibility. The implementation is solid. I have a couple of suggestions to enhance the CLI argument handling in main.go for better robustness and to ensure consistency in the documentation within README.md.

- Use flag.NArg() and flag.Arg() for cleaner argument validation
- Call flag.Usage() on error instead of duplicating the message
- Use full package path in go tool examples for consistency

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@kalbasit kalbasit merged commit 0c497ea into main Mar 21, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants